<?php
	session_start();
	include "include.php";
?>
<html>
<head>
<title><?php echo $SITE_TITLE ?> - Loot Search</title>
<link rel="stylesheet" type="text/css" href="main.css" /></head>
<div id="container">
<div id="top">
<h1><?php echo $SITE_TITLE ?></h1>
</div>
<div id="leftnav">
<?php include "leftnav.php" ?>
</div>
<div id="content">
<script src="http://www.wowhead.com/widgets/power.js"></script>
<?php
	mysql_connect(DB_HOST,DB_USER,DB_PASSWORD) or die(mysql_error());
	mysql_select_db(DB_NAME);
	$sql = "SELECT * from loots WHERE items_id = " . get_item_id($_POST["items_name"]) . ";";
	$result = mysql_query($sql);
	while($myrow = mysql_fetch_row($result)) {
		$item_data = get_item_data($myrow[3]);
		$item_id = $item_data[0];
		$item_name = $item_data[1];
		$player_name = get_player_name($myrow[1]);
		$loot_date = $myrow[2];
		$npc_id = $item_data[2];
		$npc_name = $item_data[3];
		$zone_name = $item_data[4];
		echo date("M j Y h:i:s A",$loot_date) . ": " . ucwords($player_name) . " <a href=\"http://www.wowhead.com/?item=" . $item_id . "\">" . $item_name . "</a> <a href=\"http://www.wowhead.com?npc=" . $npc_id . "\">" . $npc_name . "</a> ";
		if($myrow[4] == 0) {
			echo "Normal Pick | <a href=\"edit_loot.php?loots_id=" . $myrow[0] . "\">Edit</a>";
		}
		else {
			echo "Rot Pick | <a href=\"edit_loot.php?loots_id=" . $myrow[0] . "\">Edit</a>";
		}
		echo "<br>\n";
	}
?>
</div>
<div id="footer">
<?php include "footer.php" ?>
</div>
</div>
</body>
</html>
